﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Master/Site_InnerWeb.master" ValidateRequest="false"
    AutoEventWireup="false" CodeFile="MyCredit.aspx.vb" Inherits="private_secure_members_manage_MyCredit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>Manage My Credit</h2>
    <h3>Buy Your Credit Ready Yo Contact Your Customers</h3>
    <hr />
    <br />
    <table id="table1" class="style1">
        <tr>
            <td>
                <strong>Choose an Organisation/Business:</strong>
                <br />
                <asp:DropDownList ID="ddlEntity" runat="server" DataSourceID="SqlEntity_ds" DataTextField="Name"
                    DataValueField="ID" Width="250px" AutoPostBack="True" 
                    AppendDataBoundItems="True">
                    <asp:ListItem Value="0">Select Item from List</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:Button ID="btnBuyCredit" runat="server" Text="Buy Credits" /><br />
                <asp:SqlDataSource ID="SqlEntity_ds" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    SelectCommand="usp_GetEntityList_ByPersonId" 
                    SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:Parameter Name="PersonId" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td valign="top">
                <asp:GridView ID="GridView1" runat="server" CellPadding="4" 
                    DataSourceID="EntityCredit_ds" ForeColor="#333333" 
                    AutoGenerateColumns="False" DataKeyNames="Id">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                            SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="EntityId" HeaderText="EntityId" 
                            SortExpression="EntityId" Visible="False" />
                        <asp:BoundField DataField="Purchased" HeaderText="Credits Purchased" ReadOnly="True" 
                            SortExpression="Purchased" />
                        <asp:BoundField DataField="Used" HeaderText="Credits Used" ReadOnly="True" 
                            SortExpression="Used" />
                        <asp:BoundField DataField="Refunded" HeaderText="Credits Refunded" ReadOnly="True" 
                            SortExpression="Refunded" />
                        <asp:BoundField DataField="Balance" HeaderText="Credit Balance" ReadOnly="True" 
                            SortExpression="Balance" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="EntityCredit_ds" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                    DeleteCommand="pay.usp_EntityCreditDelete" DeleteCommandType="StoredProcedure" 
                    InsertCommand="pay.usp_EntityCreditInsert" InsertCommandType="StoredProcedure" 
                    SelectCommand="pay.usp_EntityCreditSelectByEntityId" 
                    SelectCommandType="StoredProcedure" UpdateCommand="pay.usp_EntityCreditUpdate" 
                    UpdateCommandType="StoredProcedure">
                    <DeleteParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="Purchased" Type="Int32" />
                        <asp:Parameter Name="Used" Type="Int32" />
                        <asp:Parameter Name="Refunded" Type="Int32" />
                        <asp:Parameter Name="Balance" Type="Int32" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlEntity" Name="EntityId" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="Purchased" Type="Int32" />
                        <asp:Parameter Name="Used" Type="Int32" />
                        <asp:Parameter Name="Refunded" Type="Int32" />
                        <asp:Parameter Name="Balance" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <br />
                <strong>Credit Usage for the Selected Organisation</strong><asp:GridView ID="GridView3" runat="server" CellPadding="4" ForeColor="#333333" 
                    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                    DataKeyNames="Id" DataSourceID="EntityCreditUsage_ds">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                            SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="EntityId" HeaderText="EntityId" 
                            SortExpression="EntityId" Visible="False" />
                        <asp:BoundField DataField="PersonId" HeaderText="PersonId" 
                            SortExpression="PersonId" Visible="False" />
                        <asp:BoundField DataField="RecipientsCount" HeaderText="Recipients Count" 
                            SortExpression="RecipientsCount" />
                        <asp:BoundField DataField="MessagesCount" HeaderText="Messages Count" 
                            SortExpression="MessagesCount" />
                        <asp:BoundField DataField="DisplayName" HeaderText="Display Name" 
                            SortExpression="DisplayName" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="EntityCreditUsage_ds" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                    DeleteCommand="pay.usp_EntityCreditUsageDelete" DeleteCommandType="StoredProcedure" 
                    InsertCommand="pay.usp_EntityCreditUsageInsert" InsertCommandType="StoredProcedure" 
                    SelectCommand="pay.usp_EntityCreditUsageSelectByEntityId" 
                    SelectCommandType="StoredProcedure" UpdateCommand="pay.usp_EntityCreditUsageUpdate" 
                    UpdateCommandType="StoredProcedure">
                    <DeleteParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="PersonId" Type="Int32" />
                        <asp:Parameter Name="RecipientsCount" Type="Int32" />
                        <asp:Parameter Name="MessagesCount" Type="Int32" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlEntity" Name="EntityId" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="PersonId" Type="Int32" />
                        <asp:Parameter Name="RecipientsCount" Type="Int32" />
                        <asp:Parameter Name="MessagesCount" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <br />
             </td>
            <td>
                &nbsp;</td>
            <td valign="top">
                <strong>Credit Purchase(s) for the Selected Organisation</strong><asp:GridView 
                    ID="GridView2" runat="server" 
                    CellPadding="4" ForeColor="#333333" AllowPaging="True" AllowSorting="True" 
                    DataSourceID="EntityCreditPurchase_ds" AutoGenerateColumns="False" 
                    DataKeyNames="Id">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="PersonId" HeaderText="PersonId" 
                            SortExpression="PersonId" Visible="False" />
                        <asp:BoundField DataField="AmountPurchased" HeaderText="Amount" 
                            SortExpression="AmountPurchased" />
                        <asp:BoundField DataField="DatePurchased" HeaderText="Date" 
                            SortExpression="DatePurchased" />
                        <asp:CheckBoxField DataField="Refunded" HeaderText="Refunded" 
                            SortExpression="Refunded" />
                        <asp:BoundField DataField="PaymentMethodId" HeaderText="PaymentMethodId" 
                            SortExpression="PaymentMethodId" Visible="False" />
                        <asp:BoundField DataField="PurchaseTxnId" HeaderText="PurchaseTxnId" 
                            SortExpression="PurchaseTxnId" Visible="False" />
                        <asp:BoundField DataField="DisplayName" HeaderText="Name" 
                            SortExpression="DisplayName" />
                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="EntityCreditPurchase_ds" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                    DeleteCommand="pay.usp_CreditPurchaseDelete" DeleteCommandType="StoredProcedure" 
                    InsertCommand="pay.usp_CreditPurchaseInsert" InsertCommandType="StoredProcedure" 
                    SelectCommand="pay.usp_CreditPurchaseByEntityId" 
                    SelectCommandType="StoredProcedure" UpdateCommand="pay.usp_CreditPurchaseUpdate" 
                    UpdateCommandType="StoredProcedure">
                    <DeleteParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="PersonId" Type="Int32" />
                        <asp:Parameter Name="AmountPurchased" Type="Int32" />
                        <asp:Parameter Name="DatePurchased" Type="DateTime" />
                        <asp:Parameter Name="PaymentMethodId" Type="Int32" />
                        <asp:Parameter Name="PurchaseTxnId" Type="Int32" />
                        <asp:Parameter Name="Refunded" Type="Boolean" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlEntity" Name="EntityId" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="PersonId" Type="Int32" />
                        <asp:Parameter Name="AmountPurchased" Type="Int32" />
                        <asp:Parameter Name="DatePurchased" Type="DateTime" />
                        <asp:Parameter Name="PaymentMethodId" Type="Int32" />
                        <asp:Parameter Name="PurchaseTxnId" Type="Int32" />
                        <asp:Parameter Name="Refunded" Type="Boolean" />
                    </UpdateParameters>
                </asp:SqlDataSource>
             </td>
        </tr>
         <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td valign="top">
                <asp:RadioButtonList ID="RadioButtonList1" runat="server">
                    <asp:ListItem>10 Credits</asp:ListItem>
                    <asp:ListItem>20 Credits</asp:ListItem>
                    <asp:ListItem>50 Credits</asp:ListItem>
                    <asp:ListItem>100 Credits</asp:ListItem>
                    <asp:ListItem>150 Credits</asp:ListItem>
                    <asp:ListItem>200 Credits</asp:ListItem>
                    <asp:ListItem>250 Credits</asp:ListItem>
                    <asp:ListItem>500 Credits</asp:ListItem>
                    <asp:ListItem>750 Credits</asp:ListItem>
                    <asp:ListItem>1000 Credits</asp:ListItem>
                </asp:RadioButtonList>
                <asp:Button ID="Button1" runat="server" Text="Buy Now" />
                <br />
                <br />
                <asp:CheckBoxList ID="CheckBoxList1" runat="server">
                    <asp:ListItem>10 Credits</asp:ListItem>
                    <asp:ListItem>20 Credits</asp:ListItem>
                    <asp:ListItem>50 Credits</asp:ListItem>
                    <asp:ListItem>100 Credits</asp:ListItem>
                    <asp:ListItem>150 Credits</asp:ListItem>
                    <asp:ListItem>200 Credits</asp:ListItem>
                    <asp:ListItem>250 Credits</asp:ListItem>
                    <asp:ListItem>500 Credits</asp:ListItem>
                    <asp:ListItem>750 Credits</asp:ListItem>
                    <asp:ListItem>1000 Credits</asp:ListItem>
                </asp:CheckBoxList>
                <asp:Button ID="Button2" runat="server" Text="Buy Now" />
                <br />
             </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
         <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>

</asp:Content>
